home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 5173 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  953 b 

  1. Path: noc.tor.hookup.net!news
  2. From: Rajendra_Singh@msn.com (Rajendra Singh)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Character String --> Integer
  5. Date: Thu, 08 Feb 1996 03:35:49 GMT
  6. Organization: HookUp Communication Corporation, Oakville, Ontario, CANADA
  7. Message-ID: <4fbfvi$7f@noc.tor.hookup.net>
  8. References: <4fb0ga$lsa@remus.rutgers.edu>
  9. NNTP-Posting-Host: u36u400.tor.hookup.net
  10. NNTP-Posting-User: u36u400
  11. X-Newsreader: Forte Free Agent 1.0.82
  12.  
  13. wempa@remus.rutgers.edu (Force Of Nature) wrote:
  14.  
  15. >Is there an easy way to convert a character string such as '2425' to the
  16. >integer 2425 ???  The only way I can think of is to pick off characters 
  17. >one at a time and use switch statements to determine the value (0-9) and
  18. >then multiply by the correct power of 10.  Is there an easier way to do
  19. >this ???????
  20.  
  21. int number;
  22.  
  23. number = atoi(string);
  24. ---
  25. Rajendra Singh, B. Sc. (Rajendra_Singh@msn.com)
  26. "What is understood need not be discussed." - Loren Adams
  27.  
  28.